1
Markdown 首选架构与核心基础设施
EvoClass-AI007Lesson 3
00:00

"文件即真理" 的哲学

OpenClaw 的基础是 Markdown 首选哲学。与传统的黑箱式 AI 系统不同,OpenClaw 将配置视为文档。代理存在的每一个方面——其人格、能力以及操作流程——都存储在可读性强的 Markdown 文件中。这确保了「唯一真实来源」具有透明性、版本控制能力,并且对人类和大语言模型都易于编辑。

  • SOUL.md: 核心身份与道德指南。
  • SKILL.md: 定义代理实际能力的清单。
  • AGENTS.md: 多代理协同的工程蓝图。

核心基础设施栈

为了从静态文件过渡到一个活跃的代理,OpenClaw 采用了一个强大且稳定灵活的后端架构:

  1. 代理运行时:负责管理 轨道队列的引擎室。它确保异步任务被处理,而不会引发 状态损坏,并保持 会话隔离 在每次交互中始终如一。
  2. 网关:负责网络身份与模型路由的控制平面。它充当安全盾牌,降低诸如 远程代码执行(RCE) 在 WebSocket API 上的风险。
  3. 工具层: 一个模块化接口,代理可通过它连接外部函数、API 和技能清单中定义的本地脚本。
  4. 模型无关引擎:该系统不绑定单一提供商。它可以通过 openclaw.json 路由器在 Claude、GPT 与本地模型之间自由切换。
  5. 表现层与通道: 这些是代理与用户交互的入口点(网页界面、终端或移动设备)。
配置:openclaw.json
{ "network_identity": "agent-01-alpha", "model_routing": { "primary": "anthropic/claude-3-opus", "fallback": "local/llama-3-8b" }, "env_injection": { "secure_pass": true, "policy": "prevent_leakage" } }
Type a command...
Question 1
Why does OpenClaw prioritize a Markdown-First Philosophy?
To make the files look better in a text editor.
To ensure the configuration serves as the definitive, human-readable source of truth.
To bypass the need for an LLM during execution.
Question 2
Which component is responsible for preventing State Corruption during multi-agent tasks?
The Tools Layer
The Gateway
The Agent Runtime (via Lane Queue)
Challenge: Security Breach
Mitigating RCE risks on public channels.
Scenario: You are deploying an agent to a public-facing Discord channel. You notice that the agent is trying to execute unverified shell commands, creating an RCE (Remote Code Execution) risk.
Secure
How do you use the Gateway and SKILL.md to secure the infrastructure?
Solution:
1. Gateway Level: Restrict the WebSocket API port (18789) to local traffic only or implement strict authentication tokens.
2. SKILL.md Level: Define strict "Permissions" in the YAML metadata for the Tools Layer.
3. Instruction Level: Update the Six-Layer Filtering Funnel within the skill manifest to reject any command string that contains sensitive shell operators.